<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="layui/css/layui.css">
    <script src="layui/layui.js"></script>
</head>

<body>
    <h1 id="week"></h1>
    <button class="layui-btn" onclick="get()">获取星期</button>
</body>

<script>
    function get() {
        var date = new Date();
        //获取星期数
        var day = date.getDay();
        var week = '';

        switch (day) {
            case 1:
                week = '星期一';
                break;
            case 2:
                week = '星期二';
                break;
            case 3:
                week = '星期三';
                break;
            case 4:
                week = '星期四';
                break;
            case 5:
                week = '星期五';
                break;
            case 6:
                week = '星期六';
                break;
            case 7:
                week = '星期天';
                break;
        }

        document.getElementById('week').innerText = week;
    }
</script>

</html>